<?php 
	include '../ini.php';
	include '../includes/function.php';
	if(count($_SESSION['gio_hang'])<=0)
	{
		$_SESSION['msg']='Lỗi! Bạn chưa mua hàng, vui lòng kiểm tra lại';
		$_SESSION['type_msg']='error';
		header('Location: ../home/trang-chu.html');
		exit;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
<?php include '../widgets/head.php'?>
</head>
<body>
<div id="art-page-background-glare">
  <div id="art-page-background-glare-image">
    <div id="art-main">
      <div class="art-sheet">
        <div class="art-sheet-tl"></div>
        <div class="art-sheet-tr"></div>
        <div class="art-sheet-bl"></div>
        <div class="art-sheet-br"></div>
        <div class="art-sheet-tc"></div>
        <div class="art-sheet-bc"></div>
        <div class="art-sheet-cl"></div>
        <div class="art-sheet-cr"></div>
        <div class="art-sheet-cc"></div>
        <div class="art-sheet-body">
          <?php include '../widgets/header.php'?>
          <?php include '../widgets/nav.php'?>
          <div class="art-content-layout">
            <div class="art-content-layout-row">
              <div class="art-layout-cell art-sidebar1">
                <?php sidebar('left');?>
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-content">
                <div class="art-post">
                  <div class="art-post-tl"></div>
                  <div class="art-post-tr"></div>
                  <div class="art-post-bl"></div>
                  <div class="art-post-br"></div>
                  <div class="art-post-tc"></div>
                  <div class="art-post-bc"></div>
                  <div class="art-post-cl"></div>
                  <div class="art-post-cr"></div>
                  <div class="art-post-cc"></div>
                  <div class="art-post-body">
                    <div class="art-post-inner art-article">
                    <?php thong_bao();?>
                      <h2 class="art-postheader">Giỏ hàng của bạn</h2>
                      <div class="line"> </div>
                      <div class="art-postcontent">
                        <form method="post" action="../gio-hang/cap-nhat.html">
                          <table class="gio_hang">
                            <tr>
                              <th class="xoa">Xóa</th>
                              <th class="stt">STT</th>
                              <th class="ten_sp">Tên sách</th>
                              <th class="so_luong">Số lượng</th>
                              <th class="don_gia">Đơn giá (VNĐ)</th>
                              <th class="thanh_tien">Thành tiền (VNĐ)</th>
                            </tr>                            
                              <?php
								$stt = 0;
								$tong_tien = 0;
								foreach($_SESSION['gio_hang'] as $k=>$v) 
								{
									$stt++;
							  ?>
                            <tr>
                              <td class="xoa"><a onclick="return confirm('Bạn có muốn xóa khỏi giỏ hàng không?');" href="../gio-hang/xoa-<?php echo $k?>.html"><img src="../images/b_drop.png" /></a></td>
                              <td class="stt"><?php echo $stt?></td>
                              <td class="ten_sp"><?php echo $v['ten']?></td>
                              <td class="so_luong" ><input name="sl_<?php echo $k?>" style="text-align:center" type="text" value="<?php echo $v['so_luong']?>"/></td>
                              <td class="don_gia so"><?php echo number_format($v['don_gia'],2,'.',',')?></td>
                              <td class="thanh_tien so"><?php echo number_format($v['thanh_tien'],2,'.',','); $tong_tien += $v['thanh_tien'];?></td>
                            </tr>
                              <?php
								}
							  ?>
                            <tr>
                              <td colspan="6" class="tong_tien">Tổng tiền: <?php echo number_format($tong_tien,2,'.',',');?> VNĐ </td>
                            <tr>
                              <td style="text-align: center;" colspan="7"><span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span>
                                <input type="submit" name="cap_nhat" class="art-button" value="Cập nhật" />
                                </span> <span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span>
                                <input type="button" onclick="window.location.href='../dat-hang/don-dat-hang.html'" name="thanh_toan" class="art-button" value="Thanh toán" />
                                </span> <span class="art-button-wrapper"> <span class="art-button-l"> </span> <span class="art-button-r"> </span>
                                <input type="button" onclick="window.location.href='../home/trang-chu.html'" name="tiep_tuc_mua_hang" class="art-button" value="Tiếp tục mua hàng" />
                                </span></td>
                            </tr>
                          </table>
                        </form>
                      </div>
                      <div class="cleared"></div>
                    </div>
                    <div class="cleared"></div>
                  </div>
                </div>
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-sidebar2">
                <?php sidebar('right')?>
                <div class="cleared"></div>
              </div>
            </div>
          </div>
          <div class="cleared"></div>
          <?php include '../widgets/footer.php'?>
          <div class="cleared"></div>
        </div>
      </div>
      <div class="cleared"></div>
    </div>
  </div>
</div>
</body>
</html>
